package com.xingfly.school;

import com.xingfly.school.course.domain.Course;
import com.xingfly.school.student.domain.Student;
import com.xingfly.school.course.acl.ports.repositories.CourseRepository;
import com.xingfly.school.student.acl.ports.repositories.StudentRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by SuperS on 2020/3/25.
 *
 * @author SuperS
 */
@Component
public class Init implements CommandLineRunner {

    @Resource
    private CourseRepository courseRepository;

    @Resource
    private StudentRepository studentRepository;

    @Override
    public void run(String... args) throws Exception {
        Course course = Course.create("语文课");
        Student student = Student.create("张三", "男");
        courseRepository.save(course);
        studentRepository.save(student);
    }
}
